package com.xbq.exceleditor.ui

import android.os.Bundle
import com.blankj.utilcode.util.AppUtils
import com.gyf.immersionbar.ktx.immersionBar
import com.hjq.permissions.Permission
import com.hjq.permissions.XXPermissions
import com.xbq.exceleditor.R
import com.xbq.exceleditor.databinding.ActivityOtherSettingBinding
import com.xbq.xbqsdk.component.activity.VBActivity
import com.xbq.xbqsdk.util.click.onDebouncedClick
import dagger.hilt.android.AndroidEntryPoint

/**
 * Author: liaohaiping
 * Time: 2020-10-30
 * Description:
 */
@AndroidEntryPoint
class OtherSettingActivity : VBActivity<ActivityOtherSettingBinding>() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding.adview.init("othersetting",this)
        immersionBar {
            fitsSystemWindows(true,R.color.bg)
            statusBarDarkFont(true)
        }
        binding.btnBack.onDebouncedClick { finish() }
        binding.btnSetBatteryWhiteList.onDebouncedClick {
            XXPermissions.startPermissionActivity(this,Permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)}
        binding.btnSetBackgroundPermisson.onDebouncedClick { XXPermissions.startPermissionActivity(this) }
        binding.tvOtherSettingPrompt.text = resources.getString(R.string.other_setting_prompt).replace("APP_NAME",AppUtils.getAppName())
        binding.tvBatteryOptimizeDesc.text = resources.getString(R.string.battery_optimization_white_list_desc).replace("APP_NAME",AppUtils.getAppName())
    }
}